package cn.calista.springbootdokcer;

import cn.calista.springbootdokcer.repository.NewsRepo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author tuxianchao
 * @date 2018/9/12 上午11:52
 */
@Controller
@Slf4j
public class IndexController {
    @Autowired
    private NewsRepo newsRepo;

    @GetMapping("/")
    public String index(Model model) {
        model.addAttribute("allNews", newsRepo.findAll());
        return "index.html";
    }
}
